/*
 * @Description: 
 * @Author: Liu Kunpeng
 * @Date: 2021-03-12 19:14:51
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
//引入login组件
import Home from '../components/Home.vue'
import Welcome from '../components/Welcome.vue'
import DataManage01 from '../components/DataManage01.vue'
import DataManage02 from '../components/DataManage02.vue'
import Login from '../components/Login.vue'
import Page404 from '../views/404.vue'
import Index from '../components/Index.vue'
import Profile from '../components/Profile.vue'
Vue.use(VueRouter)
  
  const routes = [
    {
      path:"/",
      component: Index
    },
    {
      path:"/login",
      component: Login
    },
    {
      path: '/404',
      component: Page404,
    },
    {
      path:"/home",
      component: Home,
      redirect: "/welcome",
      children:[
        {
          path:"/welcome",
          component: Welcome,
          meta: { title: '数据管理'}
        },
        {
          path:"/profile",
          component: Profile,
          meta: { title: '个人中心'}
        }
      ]
    },
  ]
export const footRoute = [
  {
    path:"/home",
    component: Home,
    redirect: "/welcome",
    children:[
      {
        path:"/datamanage",
        component: DataManage01,
        meta: { title: '数据管理', type:'步态分析'}
      },
    ]
  }
]
export const threeRoute = [
  {
    path:"/home",
    component: Home,
    redirect: "/welcome",
    children:[
      {
        path:"/datamanage",
        component: DataManage02,
        meta: { title: '数据管理', type:'三维扫描'}
      },
    ]
  },
]
export const endRoute = [
  {
    path: "*",
    redirect: "/404",
    hidden:true
  }
]
const createRouter = () => new VueRouter({
  base:'/user/',
  // mode: 'history',
  routes
})
const router = createRouter()

export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
  router.options.routes = routes
}

export default router
